package com.web.exiaodao.business.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.web.exiaodao.business.entity.News;


public interface NewsRepository extends
		PagingAndSortingRepository<News, Long>,
		JpaSpecificationExecutor<News> {

	public News findByIdAndStatusNot(Long id,Integer status);

	@Query(value = "SELECT COUNT(*) FROM tb_xa_news  WHERE type = ?1 AND status <> ?2 ", nativeQuery = true)
	public Long findNewsCountByCategoryIdAndStatusNot(Long categoryId,Integer status);
}
